<!-- 问卷详情 -->

<template>
  <EasyModal v-model="model" v-bind="MAP.MODEL_PROPS">
    <template #title="{ title }">
      <ParamTab v-if="model" :param="one" :isCard="false">
        <template #item="{ item }">
          <span v-if="item[0] === 'question'">{{ item[1] }} ( {{ one.questionList.length }} )</span>
          <span v-else-if="item[0] === 'answer'">{{ item[1] }} ( {{ answer_list.length }} )</span>
          <span v-else>{{ item[1] }}</span>
        </template>
      </ParamTab>
      <span class="el-dialog__title">{{ title }}</span>
    </template>

    <div class="DetailQuestionnaire-panel">
      <LeftPeriod v-if="one.questionnaireType === 3" class="full" />

      <WebShow class="full">
        <EasyScroll full>
          <!-- <MyBase v-show="one.tab === DICT.TAB[0][0]" /> -->

          <!-- <MyWelcome v-show="one.tab === DICT.TAB[1][0]" /> -->

          <!-- <MyQuestion v-show="one.tab === DICT.TAB[1][0]" /> -->

          <!-- <MySend v-show="one.tab === DICT.TAB[2][0]" /> -->

          <MyStatistic v-if="one.tab === DICT.TAB[0][0]" />

          <MyAnswer v-if="one.tab === DICT.TAB[1][0]" />
        </EasyScroll>
      </WebShow>
    </div>

    <AnswerModal />

    <StatisticModal />

    <template #footer>
      <MyFooter />
    </template>
  </EasyModal>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import store from './store'
import mixDetail from '@admin/components/detail/mixDetail'

// ============================== 导出组件 ============================== //

export default {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'DetailQuestionnaire',

  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [CORE.mixStore(store), mixDetail],

  /**
   * 组件导入 (Abc.vue + Abc/index.vue)
   */
  ...CORE.components(require.context('./', true, /vue$/)),

  /**
   * 监听属性 (深度 deep 首次 immediate)
   */
  watch: {
    /**
     * 监听单项就绪
     */
    readyOne(ready) {
      if (ready) {
        this.answer_param.questionnaireId = this.one.periodId
        this.answer_startList(1)
      }
    },

    /**
     * 监听答卷列表就绪
     */
    answer_readyList(ready) {
      if (ready) {
        this.statistic_param.questionnaireId = this.one.periodId
        this.statistic_startList(1)
      }
    },
  },
}
</script>

<style lang="scss">
@import './index.scss';
</style>
